#ifndef GRAPHWIDGET_H
#define GRAPHWIDGET_H

#include <QtGui/QGraphicsView>
#include<graphscene.h>
class Node;

class GraphWidget : public QGraphicsView
{
    Q_OBJECT

public:
    GraphWidget();
	void itemMoved();
	void setState(int newState);
	GraphScene * getScene()
	{
		return this->scenegw;
	}
	Node *getEditingNode() {
		if (state!=4)
			return NULL;
		return this->scenegw->sourceNode;
	}
	
protected:
    void keyPressEvent(QKeyEvent *event);
    void timerEvent(QTimerEvent *event);
	void wheelEvent(QWheelEvent *event);
	void scaleView(qreal scaleFactor);
    void drawBackground(QPainter *painter, const QRectF &rect);
	//void mousePressEvent ( QMouseEvent * event );

   

private:
    int timerId;
	GraphScene *scenegw;
    Node *centerNode;
	//QList<Node *> lnode;
	int state;
};

#endif
